﻿using FriendStar.Code;
using FriendStar.Domain.Entity.VBaseData;
using FriendStar.Domain.IRepository.VBaseData;
using FriendStar.Repository.VBaseData;
using System.Collections.Generic;
using System.Linq;
using SqlSugarRepository;

namespace FriendStar.Application.VBaseData
{
    public class V_ZSJ_12_GH_SuProduction_DatStorKWApp
    {
        private IV_ZSJ_12_GH_SuProduction_DatStorKWRepository service = new V_ZSJ_12_GH_SuProduction_DatStorKWRepository();

        public List<V_ZSJ_12_GH_SuProduction_DatStorKWEntity> GetList(Pagination pagination,string productionNO,string productionName,string proCompanyNO)
        {
            var expression = ExtLinq.True<V_ZSJ_12_GH_SuProduction_DatStorKWEntity>();
            if (!string.IsNullOrEmpty(productionNO))
            {
                expression = expression.And(t => t.FProductionNO.Contains(productionNO));
            }
            if (!string.IsNullOrEmpty(productionName))
            {
                expression = expression.And(t => t.FProductionName.Contains(productionName));
            }
            if (!string.IsNullOrEmpty(proCompanyNO))
            {
                expression = expression.And(t => t.FProCompanyNO.Contains(proCompanyNO));
            }
            return service.FindList(expression, pagination).ToList();
        }

        public List<V_ZSJ_12_GH_SuProduction_DatStorKWEntity> SelectPartForDropList()
        {
            var expression = ExtLinq.True<V_ZSJ_12_GH_SuProduction_DatStorKWEntity>();
            return service.FindList(expression).Select(p => new V_ZSJ_12_GH_SuProduction_DatStorKWEntity { FProductionNO = p.FProductionNO, FProductionName = p.FProductionName }).ToList();
        }
    }
}

 